<?php
include($_SERVER["DOCUMENT_ROOT"]."/bob.php");
include($_SERVER["DOCUMENT_ROOT"]."/fonctions_globales.php");
$mysqli = new_mysqli($host, $user, $password, $database); //connection à la DB
test_session_piratee($mysqli);
?>

<!DOCTYPE HTML>
<html lang="fr" dir="ltr">
<head>
<meta charset="utf-8">
<title>Post Human W.A.R.</title>
<script type="text/javascript" src="/js/swfobject.js"></script>
<script type="text/javascript" src="/js/gestion_module_jeu.js"></script>
<style type="text/css">
	*{
		margin:0;
		padding:0;
	}
    body{
		background:#1b282c url(/images/motif_insc.png); 
		color:#FFFFFF;
		margin:0px; 
		padding:0px;
		font-family:arial,verdana,tahoma;
		font-size:14px;
		line-height:20px;
	}
</style> 

<?php 
if(!empty($_SESSION['login'])){
	$result = mysqli_query_with_error($mysqli, "SELECT version_client FROM config_generale");
	$version = $result->fetch_assoc();
	$version = $version['version_client'];
    $progression_joueur = get_line_in_db($mysqli, "gens_progression", "user_id", $_SESSION['id']);
    $mdp_server = hash("sha256", "tagda".$_SESSION['login']."uu".$_SESSION['id']);
    $mdp_db = substr(get_data_in_db($mysqli, "gens", "user_id", $_SESSION['id'], "user_password"), 0, 20);
	?>
            <script>
                function load_SWF() {
                    swfobject.embedSWF('PHW.swf?vers=<?php echo $version;?>', 'moduleGame', '100%', '100%', '9.0.0', 'playerProductInstall.swf', 
                    {<?php echo 
                        "id_joueur : '".$_SESSION['id']
                       ."', lang : '".$_SESSION['lang']
                       ."', num_version : '".$version
                       ."', go_tuto : '".$progression_joueur['current_tuto']
                       ."', after_tuto : '".$progression_joueur['after_tuto']
                       ."', bulles_hot_seat : '".$progression_joueur['bulles_hot_seat']
                       ."', bulles_plibre : '".$progression_joueur['bulles_plibre']
                       ."', bulles_salle_attente : '".$progression_joueur['bulles_salle_attente']
                       ."', id_db : '$mdp_db', mdp_serv : '$mdp_server'"; 
                    ?>}, {bgcolor : "#111a1c", allowFullScreenInteractive: "true", wmode: "direct"});
                }
            </script>
        </head>
	<body onload="game_apparent = true; load_SWF(); resize_game();">
	
	<div id="ContenerGame" style='position:absolute; z-index:-1;'>
		<div id="moduleGame">  <h1>Votre plug-in Flash ne semble pas à jour.</h1>
			<p><a href="http://www.adobe.com/go/getflashplayer">
				<img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" />
			</a></p>
		</div>
	</div>
	
<?php } else { ?>
            <link rel='stylesheet' type='text/css' href='/css/formulaire.css' />
        </head>
	<body>
		<div id="inscription">
			<div>
			<img id="bouton_switch_reduire" src="../images/formulaires/reduire_btn.png" title="Accéder au site"  style="cursor:pointer;" onclick='parent.resize_jeu_menu(0);'/>
			</div>
			<form method="post" action="/perso/inscription.php" target="site_contenu">
				<div>
					<label for="name">Nom du joueur</label><br/>
					<input type="text" name="name" placeholder="Choisissez un pseudo"  autocomplete="off" id="name" maxlength="15"></input>
				</div>
				<div class="espace">
					<label for="email">Adresse email</label><br/>
					<input type="text" name="email" placeholder="Votre adresse e-mail"  autocomplete="off" id="email" maxlength="120"></input>
				</div>
				<div class="espace">
					<h2>Créer un compte</h2>
					<label for="mdp">Mot de passe</label><br/>
					<input type="password" name="mdp" placeholder="Choisissez un mot de passe"  autocomplete="off" id="mdp" maxlength="25"></input>
				</div>
				<span><input type="submit" name="inscrire" value="Suivant"/></span>
				<!--<h2>Création de compte</h2>-->
			</form>
			
		</div><!-- div inscription-->
<?php } ?>

</body></html>